home *** CD-ROM | disk | FTP | other *** search
/ Emulator Universe / Emulator Universe CD (1998).iso / CPC / Utils / PC2Tape / DECODER.DOC < prev    next >
Encoding:
Text File  |  1996-11-26  |  4.7 KB  |  112 lines

  1.  AIFF decoder: a tool for retrieving data from Amstrad CPC tapes
  2.  ---------------------------------------------------------------
  3.   (c) Pierre Guerrier, 1996 - e-mail: guerrier@ecoledoc.ibp.fr
  4.  
  5.  
  6. Legal Stuff:
  7. -----------
  8. This software is provided "as is" and with no warranty of any kind.
  9. You can redistribute if freely as long as it is unmodified.
  10. I remain the copyright owner. You can bundle or build the code into
  11. software of your own (like an emulator) provided I am credited for it.
  12.  
  13.  
  14. What is it ?
  15. -----------
  16. AIFF decoder takes an Audio Interchange Format file (AIFF, hence the name),
  17. preferably containing a digitized Amstrad CPC tape, and tries to process
  18. the sound signal to turn it back into your original data. Since AIFF is a
  19. very common format, you should be able to sample (or convert) tapes in AIFF
  20. on any machine (PC, Mac, Amiga, Unix box...) that has audio input capability.
  21.  
  22. If you need good conversion utilities, check:
  23.  Macintosh: SoundApp, by Norman Franke, franke1@llnl.gov
  24.  any UNIX: SOX, by Lance Norskog, thinman@netcom.com
  25.  
  26.  
  27. The source code given below should compile under any Unix or DOS without any
  28. change. The tapes can be recorded in SpeedWrite 1 (2400 bps, default) or 0
  29. (1200 bps), but also with the Discology speed 3600 bps, and there is
  30. provision for speeds of 4800 and 9600 bps (not supported by the firmware
  31. routines, but available with some CPC utilities).
  32. You can switch the speed with an option flag (there is no auto-guess).
  33.  
  34. Copy protections are not supported, only regular bit streams with 64 bytes
  35. headers, 2048 bytes blocks and the usual sync patterns will be recognized.
  36.  
  37.  
  38. How does it work ?
  39. ------------------
  40. First you need to compile it for your OS. Under Unix, type:
  41.  
  42. > gcc decoder.c -o AIFFdec
  43.  
  44. ... where decoder.c is the name of the C source file. For DOS boxes,
  45. you need to use a C compiler with full ANSI support (including libraries)
  46. and you must change a line at the beginning of decoder.c:
  47.  
  48. #define MSDOS 0   -------->>> #define MSDOS 1
  49.  
  50. This will ensure that file names are correctly adapted for DOS.
  51.  
  52.  
  53. Once you've got a binary, it's shell syntax is very simple:
  54.  
  55. > AIFFdec [-rpvn] file
  56.  
  57. where: 
  58.  r is an optional flag to use the second channel in stereo files (for those
  59.      with a weird cable between the CPC and the target computer :-)
  60.  p is an optional flag to change the polarity of the signal (again, it's
  61.      to make up for miswired cables)
  62.  v is the optional "verbose" function, so that internal steps of the decoding
  63.      are detailed on the console.
  64.  n is an optional numeric flag to set the signal speed, according to the
  65.      table below. Note that the sampling frequency of your machine must be
  66.      high enough for the required speed: see the table.
  67.  "file" is the AIFF file to process.
  68.  
  69. When a CPC file is correctly decoded, it is saved in a regular file on your
  70. system. This output file has a standard AMSDOS header (or no header for ASCII)
  71. and can be used immediately as a "tape file" with many emulators.
  72. AIFF decoder will notify progress, such as detection of leader,header,blocks,
  73. and new files it creates.
  74.  
  75. Should anything go wrong, AIFF decoder will put up a warning, such as:
  76.  
  77. File [name] is not valid uncompressed AIFF !
  78.   Your source file is not in the correct format. Remember that you must not
  79.   compress the audio data.
  80. Unable to process with optimal Nyquist frequency.
  81.   The sample rate of your source file is insufficient. AIFF decoder will try
  82.   to process it, but there may be errors.
  83. One rescued block !
  84.   A block without header has been found. It is appended to a "Rescued.Blocks"
  85.   file on your system.
  86. File [name] did not terminate properly !
  87.   The last blocks of the file xx have not been found (actually, the one with
  88.   the termination mark has not be found).
  89. Missed some blocks of file [name] !
  90.   The block numbers made a "leap": the result file has a "hole" in it.
  91.   In these cases, and if there has been rescued blocks, you can try "surgery" 
  92.   to clean the mess...
  93. Incorrect [DATA/HEADER] checksum: read [CRC read] for [CRC computed] !
  94.   A difference was found between the CRC on the tape and the one computed
  95.   from the extracted bit stream. There are faulty bits in the resulting file.
  96.   For text data, this will cause a few weird characters. For binaries, it is
  97.   rather lethal. There is nothing you can do except re-sampling the tape from
  98.   scratch with a better signal quality.
  99.  
  100.  
  101.  
  102. Speed Conversion table:
  103. ----------------------
  104.  
  105. option flag     baud rate     preferred sampling rate
  106.  
  107.     8           1200 (SW0)         5.5kHz
  108.   4 (default)   2400 (SW1)         11 kHz
  109.     3             3600             16 kHz
  110.     2             4800             22 kHz
  111.     1             9600             44 kHz
  112.